package com.ehome.poct.base.dao.device.repository;

import cn.hutool.core.util.ObjectUtil;
import com.ehome.mybatisplus.support.AbstractCrudRepository;
import com.ehome.poct.base.api.dto.device.AddFactoryModeDTO;
import com.ehome.poct.base.dao.device.entity.TestBloodQualityFactoryDataDO;
import com.ehome.poct.base.dao.mapping.FactoryModeMapping;
import com.ehome.poct.base.device.repository.TestBloodQualityFactoryDataRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * 设备表RepositoryImpl
 *
 * @author muqiu
 * @since  2022-02-24 09:23
 */
@Repository
public class TestBloodQualityFactoryDataRepositoryImpl extends AbstractCrudRepository<TestBloodQualityFactoryDataDO, AddFactoryModeDTO> implements TestBloodQualityFactoryDataRepository {
    
    @Autowired
    FactoryModeMapping factoryModeMapping;
    
    @Override
    public Boolean AddFactoryMode(AddFactoryModeDTO addFactoryModeDTO) {
        Boolean add = false;
        if (ObjectUtil.isNotEmpty(addFactoryModeDTO.getSno()) && ObjectUtil.isNotEmpty(addFactoryModeDTO.getAccount()) && ObjectUtil.isNotEmpty(addFactoryModeDTO.getResult())) {
            TestBloodQualityFactoryDataDO testBloodQualityFactoryData = factoryModeMapping.to(addFactoryModeDTO);
            add = testBloodQualityFactoryData.insert();
        }
        return add;
    }
}
